<script>
	import initApp from '@/common/appInit.js';
	// import openApp from '@/common/openApp.js';
	// import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
	export default {
		globalData: {
			searchText: '',
			appVersion: {},
			config: {},
			$i18n: {},
			$t: {},
			overShare: () => {
				//监听路由切换, 间接实现全局设置分享内容
				uni.onAppRoute(res => {
					console.log("间接实现全局设置分享内容");
					//获取加载的页面
					const pages = getCurrentPages(),
						//获取当前页面的对象
						view = pages[pages.length - 1];
					if (view) {
						//全局触发 显示出分享具栏
						wx.showShareMenu({
							withShareTicket: true,
							//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
							menus: ["shareAppMessage", "shareTimeline"]
						})

						view.onShareAppMessage = () => {
							//分享配置
							return {
								title: '智店星管理系统',
								path: '/pages/index/index',
								//imageUrl: '/static/images/xxxxx.png',
								success(res) {
									uni.showToast({
										title: '分享成功'
									})
								},
								fail(res) {
									uni.showToast({
										title: '分享失败',
										icon: 'none'
									})
								}
							};
						};
					}
				})
			},
		},
		onLaunch: function() {
			console.log('App Launch')
			this.globalData.$i18n = this.$i18n
			this.globalData.$t = str => this.$t(str);
			this.globalData.overShare();
			initApp();
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	page {
		background-color: transparent;
		forced-color-adjust: none;
		/* background-color: #F0F4F7; */
		--status-bar-height: 25px;
		--top-window-height: 0px;
		--window-top: 0px;
		--window-bottom: 0px;
		--window-left: 0px;
		--window-right: 0px;
		--window-magin: 0px;
		--animate-duration: 1s;
		--animate-delay: 1s;
		--animate-repeat: 1;
	}
</style>

<style lang="scss">
	@import 'common/diygw-ui/iconfont.scss';
	@import 'common/diygw-ui/animate.css';
	@import 'common/diygw-ui/index.scss';
	@import './common/uni.css';
</style>